var cookie_namespace = 'zty'; 
var footer,header,right,menu,menutd;

function readCookie(cookie) 
{
  var myCookie = cookie_namespace+"_"+cookie+"=";
  if (document.cookie) 
  {
    var index = document.cookie.indexOf(myCookie);
    if (index != -1) 
    {
      var valStart = index + myCookie.length;
      var valEnd = document.cookie.indexOf(";", valStart);
      if (valEnd == -1) 
      {
        valEnd = document.cookie.length;
      }
      var val = document.cookie.substring(valStart, valEnd);
      return val;
    }
  }
  return 0;
}

function writeCookie(cookie, val, expiration) 
{
  if (val==undefined) return;
  if (expiration == null) 
  {
    var date = new Date();
    date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
    expiration = date.toGMTString();
  }
  document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/";
}
 
function resizeWidth() 
{
  var windowWidth = $(window).width() + "px";
  right.css({width:parseInt(windowWidth)+"px"}); 
}

function restoreWidth(navWidth)
{
  var windowWidth = $(window).width() + "px";
  right.css({width:parseInt(windowWidth)+"px"});
}

function resizeHeight() 
{
  var headerHeight = header.outerHeight();
  var footerHeight = footer.outerHeight();
  
  var windowHeight = $(window).height() - headerHeight -footerHeight;
  right.css({height:windowHeight + "px"});
  menu.css({height:windowHeight + "px"});
}

function initResizable()
{
  header  = $("#head");
  right = $("#cont");
  footer  = $("#bottom");
  menu  = $("#menu");
  menutd =$("#menutd");
  $(window).resize(function() { resizeHeight();});
  resizeHeight();
}
